<%@page contentType="text/html;charset=utf-8" %>
<%@taglib prefix="s" uri="/struts-tags" %>   
<script type="text/javascript">

function cm_saveblacknumber(type)
{
    var id = document.getElementById("model.id").value;
    var number = document.getElementById("model.number").value;
    var spid = document.getElementById("model.spid").value;
    var file = document.getElementById("blackFile").value;

    if (/*rl_id == null || rl_id == "" 
        || */ ((number == null || number == "")
        		&& (file == null || file==""))
        || spid == null || spid == "")
    {
        alert("信息不完整！");
        return false;
    }

    if (!confirm("确定继续？"))
    {
        return false;
    }
    var url = "mg/blacknumber/save.do";
    document.getElementById("type").value=type;
    /*var content = "type=" + type
                + "&model.id=" + id
                + "&model.number=" + number
                + "&model.spid=" + spid;*/
    /*alert(content);*/
    var objectid = "cm_blacknumber";
    /*sendXMLHttpRequest(url, content, objectid);*/ 
    postXMLHttpRequest(url, "myform", objectid);
}
</script>
 <table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="5"></td>
    <td>   
  <form name="myform" id="myform" enctype="multipart/form-data" method="post" action="">
  <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td colspan="3">
        <table width="100%"  border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td><img src="images/table_top_left.jpg" width="20" height="15" /></td>
            <td><img src="images/table_top_bg.jpg" width="770" height="15"/></td>
            <td align="right">
              <img src="images/table_top_right.jpg" width="20" height="15" /></td>
          </tr>
        </table>
      </td>
    </tr>
    <tr>
      <td height="25" colspan="3" class="table_blue">
        <strong><img src="images/dot.jpg" width="13" height="9">黑名单信息</strong></td>
    </tr> 
    <tr>
      <td class="table_w1" align="center" width="10%">投诉SP：</td>
      <td class="table_w2" colspan="2">&nbsp;
          <input type="hidden" id="type" name="type" value="" />
          <select name="model.spid" id="model.spid">
          		<option value="">--选择投诉SP--</option>
          	<s:iterator value="splist" status="stat">
          		<option value="<s:property value="id"/>" <s:if test="id.equals(model.spid)">selected</s:if> ><s:property value="spName"/></option>
          	</s:iterator>
          </select>
      </td>
    </tr>
    <tr>
      <td class="table_w1" align="center" width="20%">&nbsp;<font color="red">(*)</font>手机号码：</td>
      <td class="table_w2" colspan="2">&nbsp;
        <input id="model.id" name="model.id" type="hidden" value="<s:property value="model.id" />" >
        <input id="model.number" name="model.number" type="text" size="20" 
          value="<s:property value="model.number" />" />或
        <input id="blackFile" name="blackFile" type="file" /></td>
    </tr>
    <tr>
      <td colspan="3" class="table_w1" align="center">
        <s:if test="type.equals('insert')" >
        <button id="btn2" dojoType="dijit.form.Button"
            onclick="cm_saveblacknumber('insert');">添加</button>
        </s:if>
        <s:else>
        &nbsp;&nbsp;        
        <button id="btn3" dojoType="dijit.form.Button"
            onclick="cm_saveblacknumber('delete');">删除</button>
        </s:else>
      </td>      
    </tr>
    <tr> 
      <td colspan="3" background="images/table_bom_bg.jpg">
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td><img src="images/table_bom_left.jpg" width="20" height="15"></td>
          <td></td>
          <td align="right">
            <img src="images/table_bom_right.jpg" width="20" height="15"></td>
        </tr>
        </table>
      </td>
    </tr>
  </table>  
  </form>
  </td>
  <td width="5"></td>
  </tr>
  </table>
  <div id="cm_blacknumber"></div> 